package top.soulblack.purchasesale.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.soulblack.purchasesale.mapper.WechatNavMapper;
import top.soulblack.purchasesale.model.Role;
import top.soulblack.purchasesale.model.WechatNav;

import java.util.List;

@Service
@Slf4j
public class WechatNavService {

    @Autowired
    private WechatNavMapper wechatNavMapper;

    /***
     * @Author li
     * @Description 获取用户导航
     * @Date 10:03 2019/8/7
     * @Param [roles]用户角色
     * @return java.util.List<top.soulblack.purchasesale.model.WechatNav>
     */
    public List<WechatNav> getUserMainNav(List<Role> roles){
        return wechatNavMapper.selectByPid(0);
    };

    /***
     * @Author li
     * @Description 获取该子目录下的导航信息
     * @Date 15:16 2019/8/7
     * @Param [pid, roles]
     * @return java.util.List<top.soulblack.purchasesale.model.WechatNav>
     */
    public List<WechatNav>getUserChildPageNav(Integer pid){
        return wechatNavMapper.selectByPid(pid);
    };

    public WechatNav getById(Integer id){
        return wechatNavMapper.selectByPrimaryKey(id);
    }

    public List<WechatNav>getPerloadList(){
        return wechatNavMapper.selectPerloadPage();
    };
}
